import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '预警名称',
    align: "center",
    dataIndex: 'expireTipName'
  },
  {
    title: '预警标记',
    align: "center",
    dataIndex: 'expireTipTag'
  },
  {
    title: '大于',
    align: "center",
    dataIndex: 'lessThan'
  },
  {
    title: '小于等于',
    align: "center",
    dataIndex: 'greateThan'
  },
  {
    title: '描述',
    align: "center",
    dataIndex: 'expireTipDesc'
  },
  {
    title: '创建人',
    align: "center",
    dataIndex: 'createBy'
  },
  {
    title: '创建日期',
    align: "center",
    sorter: true,
    dataIndex: 'createTime'
  },
  {
    title: '更新人',
    align: "center",
    dataIndex: 'updateBy'
  },
  {
    title: '更新日期',
    align: "center",
    sorter: true,
    dataIndex: 'updateTime'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "预警名称",
    field: 'expireTipName',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "预警标记",
    field: 'expireTipTag',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "大于",
    field: 'lessThan',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "创建人",
    field: 'createBy',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "更新人",
    field: 'updateBy',
    component: 'Input',
    //colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '预警名称',
    field: 'expireTipName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入预警名称!'},
             ];
    },
  },
  {
    label: '预警标记',
    field: 'expireTipTag',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入预警标记!'},
             ];
    },
  },
  {
    label: '大于',
    field: 'lessThan',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入大于!'},
             ];
    },
  },
  {
    label: '小于等于',
    field: 'greateThan',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入小于等于!'},
             ];
    },
  },
  {
    label: '描述',
    field: 'expireTipDesc',
    component: 'InputTextArea',
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  expireTipName: {title: '预警名称',order: 0,view: 'text', type: 'string',},
  expireTipTag: {title: '预警标记',order: 1,view: 'text', type: 'string',},
  lessThan: {title: '大于',order: 2,view: 'number', type: 'number',},
  greateThan: {title: '小于等于',order: 3,view: 'number', type: 'number',},
  expireTipDesc: {title: '描述',order: 4,view: 'textarea', type: 'string',},
  createBy: {title: '创建人',order: 5,view: 'text', type: 'string',},
  createTime: {title: '创建日期',order: 6,view: 'datetime', type: 'string',},
  updateBy: {title: '更新人',order: 7,view: 'text', type: 'string',},
  updateTime: {title: '更新日期',order: 8,view: 'datetime', type: 'string',},
};
